package com.dgw.mybatis.dao;

import com.dgw.mybatis.entity.User;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper2 {

    @Results(id="usermap",
            value={
                @Result(property = "id", column = "id", id = true),
                @Result(property = "user_name", column = "user_name"),
                @Result(property = "user_password", column = "user_password")

    })
    @Select("SELECT * FROM user WHERE #{username}")
    User findUserByUsername(@Param("username") String username);


 /*   @ResultMap("usermap")
    @Select("SELECT * FROM user WHERE #{id}")
    User findUserById(@Param("id") String id);*/


    // pagehelper 使用方式
    @Select("SELECT * FROM USER")
    Page<User> getUserList();
}